<?php
  class Script {
    /**
     * Define if the current script runs in console or through a browser.<br />
     *
     * @return boolean TRUE if the script runs in console, FALSE otherwise.<br />
     *
     * @see <a href="http://be.php.net/manual/en/function.php-sapi-name.php">php_sapi_name()</a>
     */
    public static function runsInConsole() {
      return (php_sapi_name() == "cli" && empty($_SERVER['REMOTE_ADDR']));
    }

  }
?>
